package collection.list;

import java.lang.reflect.Field;
import java.util.HashMap;

/**
 * --add-opens java.base/java.lang=ALL-UNNAMED
 * --add-opens java.base/java.util=ALL-UNNAMED
 * --add-opens java.base/java.nio=ALL-UNNAMED
 * --add-opens java.base/sun.nio.ch=ALL-UNNAMED
 * 需要添加JVM options指令
 */
public class Test4 {
    public static void main(String[] args) throws Exception{

    }

    public static void showSize(HashMap map) throws Exception {
        Class<?> clazz = map.getClass();
        Field table = clazz.getDeclaredField("table");
        table.setAccessible(true);
        Object[] o = (Object[])table.get(map);
        System.out.println(o.length);
    }
}
